import toml
from alibabacloud_dingtalk import Client, Auth



_cfg = toml.load('utils/config.toml')
_robot_url = _cfg['DINGROBOT']['robot_url2']
appkey = _cfg['DINGROBOT']['appkey']
appsecret = _cfg['DINGROBOT']['appsecret']
print(_robot_url)
# appkey = 'your_appkey'
# appsecret = 'your_appsecret'

auth = Auth(appkey, appsecret)
access_token = auth.get_access_token()

client = Client(access_token)

# 发送文本消息到指定的群聊或个人
chat_id = 'xxxxxxxxxxxxx'  # 群聊ID或者用户在钉钉上的唯一标识
message = {
    "msgtype": "text",
    "text": {"content": "Hello, DingTalk Stream SDK!"}
}
response = client.message.send(chat_id, message)
print(response)